import { admincreateCategories, admingetCategory } from "@/type/category";
import request from "@/utils/request";

//管理员查询分类列表
export const admingetCategories=(data:admingetCategory)=>{
    return request({
        url:'/admin/categories',
        method:'get',
        params:data
    })
}

//管理员查询分类详情
export const admingetCategoryDetail=(id:string)=>{
    return request({
        url:`/admin/categories/${id}`,
        method:'get'
    })
}

//管理员创建分类
export const admincreateCategory=(data:admincreateCategories)=>{
    return request({
        url:'/admin/categories',
        method:'post',
        data
    })
}

//管理员删除分类
export const admindeleteCategory=(id:string)=>{
    return request({
        url:`/admin/categories/${id}`,
        method:'delete',
    })
}

//管理员修改分类
export const adminupdateCategory=(id:string,data:admincreateCategories)=>{
    return request({
        url:`/admin/categories/${id}`,
        method:'put',
        data
    })
}